<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>修改商品</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 20px;
        }
        h1 {
            color: #333;
        }
        form {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 500px;
            margin: auto;
        }
        label {
            font-weight: bold;
            margin: 10px 0 5px;
            display: block;
        }
        input[type="text"], textarea {
            width: 100%;
            padding: 8px;
            border-radius: 4px;
            border: 1px solid #ccc;
            margin-bottom: 15px;
            box-sizing: border-box;
        }
        textarea {
            resize: vertical;
        }
        input[type="radio"] {
            margin-right: 10px;
        }
        input[type="submit"], input[type="reset"] {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 15px;
            cursor: pointer;
            border-radius: 4px;
            margin-top: 10px;
        }
        input[type="submit"]:hover, input[type="reset"]:hover {
            background-color: #45a049;
        }
        .button-group {
            display: flex;
            justify-content: space-between;
        }
        .form-group {
            margin-bottom: 15px;
        }
    </style>
</head>
<body>

<h1>修改商品</h1>

<form name="myform" action="${pageContext.request.contextPath}/ProductServlet" method="post">
    <input type="hidden" name="method" value="update">

    <div class="form-group">
        <label for="productId">商品编号:</label>
        <input type="text" id="productId" name="productId" readonly value="${product.productId}">
    </div>

    <div class="form-group">
        <label for="productName">商品名称:</label>
        <input type="text" id="productName" name="productName" value="${product.productName}">
    </div>

    <div class="form-group">
        <label for="price">商品单价:</label>
        <input type="text" id="price" name="price" value="${product.productPrice}">
    </div>

    <div class="form-group">
        <label for="productDesc">商品描述:</label>
        <textarea id="productDesc" name="productDesc" rows="5">${product.productDesc}</textarea>
    </div>

    <div class="form-group">
        <label for="productImage">商品图片:</label>
        <input type="text" id="productImage" name="productImage" value="${product.productImage}">
    </div>

    <div class="form-group">
        <label for="quantity">库存数量:</label>
        <input type="text" id="quantity" name="quantity" value="${product.quantity}">
    </div>

    <div class="form-group">
        <label>是否推荐:</label>
        <input type="radio" name="recommend" value="true" <c:if test="${product.recommend == true}">checked</c:if>>是&nbsp;&nbsp;
        <input type="radio" name="recommend" value="false" <c:if test="${product.recommend == false}">checked</c:if>>否
    </div>

    <div class="button-group">
        <input type="submit" name="submit" value="保存">
        <input type="reset" name="reset" value="取消">
    </div>
</form>

</body>
</html>
